# Contributor: Lindsay Zhou <i@lin.moe>
# Maintainer: Lindsay Zhou <i@lin.moe>
pkgname=fcitx5-chinese-addons
pkgver=5.1.7
pkgrel=0
pkgdesc="Chinese Addons for Fcitx"
url="https://github.com/fcitx/fcitx5-chinese-addons"
# s390x, ppc64le, riscv64: qt6-qtwebengine
arch="all !riscv64 !s390x !ppc64le"
license="LGPL-2.1-or-later AND GPL-2.0-or-later"
makedepends="
	boost-dev
	cmake
	curl-dev
	extra-cmake-modules
	fcitx5-dev
	fcitx5-lua-dev
	fcitx5-qt-dev
	fmt-dev
	gettext-dev
	libime-dev
	libpinyin-dev
	opencc-dev
	qt6-qtbase-dev
	qt6-qtwebengine-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/fcitx/fcitx5-chinese-addons/archive/refs/tags/$pkgver.tar.gz"
options="net" # checksummed data modules

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DUSE_WEBKIT=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E testchttrans
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
5073eb486b3677725755ad68d17091c3b4a1246ef34d474735a7f2853964d9c457e3d96f74ec5fbbbaf387622b1992b93571c7e7941b9ac6afa9e831c1448576  fcitx5-chinese-addons-5.1.7.tar.gz
"
